package com.uinnova.springboot.aop;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@RestController
public class AopController {

    @AopAnnotation(value  = "aop1")
    @RequestMapping(value = "/jail/aop")
    public AopDTO aop(HttpServletRequest request){
        HttpSession session = request.getSession();
        System.out.println("我应该在中间");
        AopDTO aopDTO = new AopDTO();
        aopDTO.setAge(23);
        aopDTO.setName("wanggang");
//        测试httpSessionListener过滤器
        session.setAttribute("user",aopDTO);
//        System.out.println("session  user 的值为："+session.getAttribute("user"));
        return aopDTO;
    }
}
